package logic

import (
	"context"
	"wxapi/internal/services"

	"wxapi/internal/svc"
	"wxapi/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type ReadSystemNotifyLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewReadSystemNotifyLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ReadSystemNotifyLogic {
	return &ReadSystemNotifyLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *ReadSystemNotifyLogic) ReadSystemNotify(req *types.ReadSystemNotifyReq) error {
	userId, err := services.GetUserIdBySession(l.ctx, l.svcCtx, req.Session)
	if err != nil {
		return err
	}

	services.ReadSystemNotify(l.ctx, l.svcCtx, req.ID, userId)

	return nil
}
